import 'package:flutter/material.dart';
import 'package:amap_chengbie/amap_chengbie.dart';

void main() {
  runApp(new MaterialApp(home: new MyApp()));
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    initMapKey();
  }

  void initMapKey() async {
    await AmapSpecial.init('3fa49f6aaf0e967e920ddca366f0bbde');
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.blueAccent,
        title: Text('高德导航'),
      ),
      body: Center(
          child: InkWell(
        child: Container(
          padding: EdgeInsets.all(10.0),
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.all(Radius.circular(10.0)),
            border: Border.all(
              width: 1,
              color: Colors.blueAccent,
            ),
            boxShadow: [
              BoxShadow(
                  color: Colors.blueAccent,
                  offset: Offset(0.0, 6.0), //阴影y轴偏移量
                  blurRadius: 0, //阴影模糊程度
                  spreadRadius: 0 //阴影扩散程度
                  )
            ],
          ),
          child: Text('开始导航'),
        ),
        onTap: () => AMapNavi().startNavi(
          naviType: AMapNavi.drive,
        ),
      )),
    );
  }
}
